package cn.ecut.servlet;

import cn.ecut.model.News;
import cn.ecut.services.Newsservices;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class OpenNewsServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id=req.getParameter("id");
        Newsservices newsservices=new Newsservices();
        News news=newsservices.Opennews(id);
        req.setAttribute("news",news);
        req.getRequestDispatcher("/News.jsp").forward(req,resp);


    }
}
